package com.sixkey.controller.app;

/**
 * ClassName: IndexController
 * Package: com.sixkey.controller.api
 * Description:
 *
 * @Author: @weixueshi
 * @Create: 2023/10/2 - 16:13
 * @Version: v1.0
 */

import com.sixkey.response.Response;
import com.sixkey.service.INoticeService;
import com.sixkey.service.IRoomService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * 小程序端的首页请求控制转发
 */
@Slf4j
@Validated
@CrossOrigin
@RestController
@RequestMapping("/api/index")
@RequiredArgsConstructor
public class ApiIndexController {

    private final IRoomService roomService;

    private final INoticeService noticeService;

    /**
     * 获取首页会议室图片
     * @return
     */
    @GetMapping("/image")
    public Response getImage(){
        log.info("小程序端首页获取会议室图片请求进来！");
        List<Map<String,Object>> image = roomService.getImage();
        return Response.success(image);
    }

    /**
     * 获取首页公告内容
     * @return
     */
    @GetMapping("/notice")
    public Response getNotice(){
        log.info("获取首页公告内容请求进来！");
        List<String> notice = noticeService.getNotice();
        return Response.success(notice);
    }
}
